<?php include_once("right_head.php")?>
<script type="text/javascript" src="<?php echo base_url();?>resources/backstage/ueditor1_4_3/ueditor.config.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>resources/backstage/ueditor1_4_3/ueditor.all.js"></script>
<div class="common">
    <div class="goodsTitle">
        <a href="<?php echo base_url();?>admin/categoryaction/index/<?php echo $type ?>" class="topBtn">返回列表</a>
    </div>
    <div class="adduser">
        <form action="<?php echo base_url();?>admin/categoryaction/<?php if($act == 'edit'){echo 'editCat';}else{echo 'addCat';}?>" method="post" enctype="multipart/form-data">
            <input name="act" value="<?php if($act == 'edit'){echo 'editCat';}else{echo 'addCat';}?>" type="hidden">
            <input name="type" type="hidden" value="<?php echo $type?>">
            <?php if($act == 'edit'){?>
            <input name="cat_id" type="hidden" value="<?php echo $catId?>">
            <?php }?>
            <table class="addTable">
                <tr>
                    <td align="right">分类名：</td>
                    <td><input id="cat_name" name="cat_name" value="<?php echo empty($catInfo)?'':$catInfo->cat_name?>" must="ture"  class="normalText"/><span class="tips">*</span></td>
                </tr>
                <?php
                    if(!empty($type) && $type == 2){
                ?>
                <tr>
                    <td align="right">英文名：</td>
                    <td><input id="cat_name_en" name="cat_name_en" value="<?php echo empty($catInfo)?'':$catInfo->cat_name_en?>"  class="normalText"/></td>
                </tr>
                    <?php }?>
                <tr>
                    <td align="right">上级分类：</td>
                    <td><select name="part_id" class="fl normalSelect">

                            <?php foreach($categoryList as $v){?>
                                <option
                                    <?php
                                        if($partId == $v->cat_real_id){echo 'selected="selected"';}
                                        if(isset($catId) && $catId == $v->cat_id){echo ' disabled';}
                                    ?> value="<?php echo $v->cat_real_id?>"><?php echo $v->cat_name?></option>
                            <?php }?>
                        </select></td>
                </tr>
                <tr>
                    <td align="right">是否显示：</td>
                    <td>
                        <label class="normalLabel fl"><input type="radio" name="is_show" class="is_show" value="1" <?php if((!empty($catInfo) && $catInfo->is_show == 1) or empty($catInfo)){echo 'checked';}?>>是</label>
                        <label class="normalLabel fl"><input type="radio" name="is_show" class="is_show" value="0" <?php if(!empty($catInfo) && $catInfo->is_show == 0){echo 'checked';}?>>否</label>
                    </td>
                </tr>
                <?php
                    if(!empty($type) && $type == 2){
                ?>
                <tr>
                    <td align="right">缩略图：</td>
                    <td>
                        <?php
                            if(!empty($catInfo) && !empty($catInfo->cat_img)){
                        ?>
                        <img src="<?php echo $catInfo->cat_img?>" width="100">
                        <a href="javascript:;" class="delGoodsImg" onclick="delGoodsImg(this,'<?php echo base_url() ?>','1',<?php echo empty($catId)?'':$catId?>,'')" title="删除"></a><br>
                        <?php }?>
                        <input style="width: 200px; border: none" id="cat_img" name="cat_img" type="file"  class="normalText"/><span style="color:#f00">（最佳分辨率：428*214）</span>
                    </td>
                </tr>

                <tr>
                    <td align="right">热门分类：</td>
                    <td>
                        <label class="normalLabel fl"><input type="radio" name="rmd" class="is_show" value="1" <?php if(!empty($catInfo) && $catInfo->is_rmd == 1){echo 'checked';}?>>是</label>
                        <label class="normalLabel fl"><input type="radio" name="rmd" class="is_show" value="0" <?php if(empty($catInfo) or $catInfo->is_rmd == 0){echo 'checked';}?>>否</label>
                    </td>
                </tr>
                <!-- donkey star-->
                <tr>
                    <td align="right">售卖单位：</td>
                    <td><input id="unit" name="unit" value="<?php echo empty($catInfo)?'':$catInfo->cat_unit?>" class="normalText" /></td>
                </tr>
                <!-- donkey end-->
                <?php }?>
                <tr>
                    <td align="right">排序：</td>
                    <td><input id="sort" name="sort" value="<?php echo empty($catInfo)?'':$catInfo->sort?>" class="normalText" /></td>
                </tr>

                <?php /*?>
                <tr>
                    <td align="right">一级分类名称图片(产品中心)：</td>
                    <td>
                        <?php
                        if(!empty($catInfo) && !empty($catInfo->cat_img_product)){
                            ?>
                            <img src="<?php echo $catInfo->cat_img_product?>" width="100">
                            <a href="javascript:;" class="delGoodsImg" onclick="delGoodsImg(this,'<?php echo base_url() ?>','1',<?php echo empty($catId)?'':$catId?>,'')" title="删除"></a><br>
                        <?php }?>
                        <input style="width: 200px; border: none" id="cat_img_product" name="cat_img_product" type="file"  class="normalText"/><span style="color:#f00">（最佳分辨率：73*77）</span>
                    </td>
                </tr>
                <tr>
                    <td align="right">产品一级分类图(微网站)：</td>
                    <td>
                        <?php
                        if(!empty($catInfo) && !empty($catInfo->cat_img_weixin)){
                            ?>
                            <img src="<?php echo $catInfo->cat_img_weixin?>" width="100">
                            <a href="javascript:;" class="delGoodsImg" onclick="delGoodsImg(this,'<?php echo base_url() ?>','1',<?php echo empty($catId)?'':$catId?>,'')" title="删除"></a><br>
                        <?php }?>
                        <input style="width: 200px; border: none" id="cat_img_weixin" name="cat_img_weixin" type="file"  class="normalText"/><span style="color:#f00">（最佳分辨率：32*32）</span>
                    </td>
                </tr>
                <tr>
                    <td align="right">产品一级分类当前效果图(微网站)：</td>
                    <td>
                        <?php
                        if(!empty($catInfo) && !empty($catInfo->cat_img_wenxin_now)){
                            ?>
                            <img src="<?php echo $catInfo->cat_img_wenxin_now?>" width="100">
                            <a href="javascript:;" class="delGoodsImg" onclick="delGoodsImg(this,'<?php echo base_url() ?>','1',<?php echo empty($catId)?'':$catId?>,'')" title="删除"></a><br>
                        <?php }?>
                        <input style="width: 200px; border: none" id="cat_img_wenxin_now" name="cat_img_wenxin_now" type="file"  class="normalText"/><span style="color:#f00">（最佳分辨率：32*32）</span>
                    </td>
                </tr>
                <tr style="margin-top:10px;">
                    <td align="right" valign="top">分类相册(产品中心)：</td>
                    <td>

                        <?php
                        $imgStr = '';
                        if(!empty($catInfo) && !empty($catInfo->cat_img_weixin_photo)){
                            $imgArr = explode('*&*',$catInfo->cat_img_weixin_photo);
                            $imgStr = implode(',',$imgArr);
                            foreach($imgArr as $k => $v){
                            ?>
                            <div class="goodsImgs_list fl">
                              <img src="<?php echo $v?>" width="100">
                              <a href="javascript:;" class="delGoodsImg" onclick="delGoodsImgs(this,'<?php echo base_url() ?>','1',<?php echo empty($catId)?'':$catId?>)" title="删除"></a>
                              <a href="javascript:;" class="upGoodsImg" onclick="upGoodsImgs(this,'<?php echo base_url() ?>','1',<?php echo empty($catId)?'':$catId?>)" title="向前"></a>
                              <a href="javascript:;" class="downGoodsImg" onclick="downGoodsImgs(this,'<?php echo base_url() ?>','1',<?php echo empty($catId)?'':$catId?>)" title="向后"></a>
                            </div>
                        <?php }}?>
                        <div class="clearfix"></div>
                        <input type="hidden" id="goodsImgs" value="<?php echo $imgStr?>"/>
                        <div class="uploadImg"><input multiple  style="width: 200px; border: none" name="cat_img_weixin_photo[]" type="file"  class="normalText"/><span style="color:#f00">（最佳分辨率：1003*331）</span></div>
                        <a href="javascript:;" class="addUploadImg">增加</a>
                    </td>
                </tr>
                <?php */?>
                <tr height="60"><td></td><td><button class="sub" type="submit" onclick="return subForm()">提交</button></td></tr>
            </table>
    
    </form>
    </div>

</div>
</body>
</html>